<?php

namespace app\model;

use think\facade\Db;
use think\Model;

class CourseOperationsModel extends Model {

    protected $table ="course_operations";

    protected $pk = 'id';

    public $cacheKey="course:operations:id";

    private $cacheTime=5184000;




    /*
   * 获取订单状态详情
   * */
    public function getInfo(){
        $cacheKey = $this->cacheKey;
        $redisModel = new RedisModel();
        $info = $redisModel->get($cacheKey);
        if($info){
            return json_decode($info,true);
        }

        $info = Db::name($this->table)->find(1);

        if($info){
            $redisModel->set($cacheKey,json_encode($info,256),$this->cacheTime);
            return $info;
        }
        return $info;
    }


    

}